#include <stdio.h>
#include <string.h>

char * my_strpbrk(char *s1,char *accept)
{
    char *temp;
    char *result;
    
    while(*accept !='\0')
    {
        temp = strchr(s1,*accept);
        if(temp != NULL)
        {
            result = temp;
            while(*accept != '\0')
            {
                temp = strchr(s1,*accept);

                if(temp != NULL && temp < result)
                {
                    result = temp;
                }  
                accept++;
            }
            return result;
        }
        accept++;        
    }
    return result;    
}

int main(int argc,char *argv[])
{
    char src[100] = "hello world";

    char *accept = "bcea";

    //strchr   strrchr
    //char *result = strrchr(src,'o');

    char *result = my_strpbrk(src,accept);
    printf("result = %s\n",result);
    return 0;
}